//
//  DmPage.h
//  FoxitApp
//
//  Created by sijia_liu on 15/4/27.
//
//

//#import "FXInc.h"
#import "RDKStringDrawUtil.h"
#import "FSPDFObjC.h"


@class DmDocMgr;
//@class DmAnnot;
@class DmDocument;
@protocol IDvPageView;
@class DmTextPage;
@class OFDViewControl;
@interface DmPage : NSObject
@property (nonatomic, retain) FSPDFPage *fspage;
@property (nonatomic, assign) int rotate;
@property (nonatomic, retain) DmDocument *document;
@property (nonatomic, assign) NSUInteger pageIndex;
@property (nonatomic, retain) DmTextPage *textPage;
@property (nonatomic, retain) NSMutableArray* annots;
@property (nonatomic, assign) int annotCount;

@property (nonatomic, retain) FSAnnot *currentAnnot;

//@property (nonatomic,strong)OFDViewControl *pdfViewController;


- (id)init:(DmDocument*)document index:(int)index;

- (UIImage *)drawPage:(int)dibWidth
            dibHeight:(int)dibHeight
                 pdfX:(int)pdfX
                 pdfY:(int)pdfY
             pdfWidth:(int)pdfWidth
            pdfHeight:(int)pdfHeight
   iconChangeWithPage:(BOOL)iconChangeWithPage
            withAnnot:(DrawWithAnnot)withAnnot
          isNightMode:(BOOL)isNightMode
             needCrop:(BOOL)needCrop;

- (UIImage*)drawAnnotation:(CGContextRef)context pageView:(id<IDvPageView>)pageView dibWidth:(int)dibWidth dibHeight:(int)dibHeight pdfX:(int)pdfX pdfY:(int)pdfY pdfWidth:(int)pdfWidth pdfHeight:(int)pdfHeight;
- (void)drawPrint:(CGContextRef)context width:(int)width height:(int)height withAnnot:(DrawWithAnnot)withAnnot;
- (UIImage*)getAnnotImage:(FSAnnot *)annot context:(CGContextRef)context dibWidth:(int)dibWidth dibHeight:(int)dibHeight pdfX:(int)pdfX pdfY:(int)pdfY pdfWidth:(int)pdfWidth pdfHeight:(int)pdfHeight;

- (CGSize)getPageSize;
- (CGSize)getPageCroppedSize;
- (CGRect)getPageContentRect;
-(FSMatrix *)getMatrix:(int)pdfX pdfY:(int)pdfY pdfWidth:(int)pdfWidth pdfHeight:(int)pdfHeight rotation:(enum FS_ROTATION)rotation;

//- (SearchResult*)searchPage:(NSString*)keyword utility:(RStringDrawUtil *)util forWidth:(float)width;

- (void)getFromCroppedRect:(int*)pdfX pdfY:(int*)pdfY pdfWidth:(int*)pdfWidth pdfHeight:(int*)pdfHeight;
- (CGRect)getPageCroppedRect;

- (BOOL)onPageViewLongPress:(id<IDvPageView>)pageView recognizer:(UILongPressGestureRecognizer *)recognizer;
- (BOOL)onPageViewTap:(id<IDvPageView>)pageView recognizer:(UITapGestureRecognizer *)recognizer;
- (BOOL)onPageViewPan:(id<IDvPageView>)pageView recognizer:(UIPanGestureRecognizer *)recognizer;
- (BOOL)onPageViewShouldBegin:(id<IDvPageView>)pageView recognizer:(UIGestureRecognizer *)gestureRecognizer;


- (BOOL)onPageViewTouchesBegan:(id<IDvPageView>)pageView touches:(NSSet*)touches withEvent:(UIEvent*)event;
- (BOOL)onPageViewTouchesMoved:(id<IDvPageView>)pageView touches:(NSSet *)touches withEvent:(UIEvent *)event;
- (BOOL)onPageViewTouchesEnded:(id<IDvPageView>)pageView touches:(NSSet *)touches withEvent:(UIEvent *)event;
- (BOOL)onPageViewTouchesCancelled:(id<IDvPageView>)pageView touches:(NSSet *)touches withEvent:(UIEvent *)event;

@end
